import fetch from 'common/src/utils/fetch'
import UTILS from "common/src/utils/utils";
function getFailCredit(){//获取不及格学分设置
    return fetch ({
        url:`/api/scoremanagementservice/scoreFailCreditManageController/getFailCredit`,
        method:'get',
       
    })
}
function saveFailCredit(data){//保存不及格学分设置
    return fetch ({
        url:`/api/scoremanagementservice/scoreFailCreditManageController/saveFailCredit`,
        method:'post',
        data
       
    })
}
function queryFailCreditSection(){
    return fetch({
        url:'/api/scoremanagementservice/scoreFailCreditManageController/queryFailCreditSection',
        method:'get'
    })
}
function queryFailCreditStudentPage(data){
    return fetch({
        url:'/api/scoremanagementservice/scoreFailCreditManageController/queryFailCreditStudentPage',
        method:'post',
        data
    })
}
/**
 * 查询学籍变动情况信息
 * @param {*} data 
 */
function queryChangeInfoData(studentId){
    return fetch({
        url:`/api/scoremanagementservice/scoreFailCreditManageController/queryLearnChange?studentId=${studentId}`,
        method:'get',
    })
}
/**
 * 查询 学习情况/退学处理 告知书信息
 * @param {*} data 
 */
function queryConditionData(studentId){
    return fetch({
        url:`/api/scoremanagementservice/scoreFailCreditManageController/queryStudentInfo?studentId=${studentId}`,
        method:'get',
    })
}
/**
 * 查询导出学生名单信息
 * @param {*} data 
 */
function queryStudentListData(data){
    return fetch({
        url:'/api/scoremanagementservice/scoreFailCreditManageController/queryFailCreditStudent',
        method:'post',
        data
    })
}
/**
 * 导出
 */
function exportStuInfo(studentId, exportType) {
    return fetch({
        url:`/api/scoremanagementservice/scoreFailCreditManageController/exportNotificationPdf?studentId=${studentId}&language=cn&exportType=${exportType}`,
        method:'get',
        headers: { 'Content-Type': 'text/plain;charset=UTF-8' },
        responseType: 'blob'
    }).then(res => {
        UTILS.downloadFile(res, exportType === 1 ? '学习情况告知书.pdf' : '退学处理告知书.pdf', 'application/vnd.ms-pdf;charset=utf-8');
    });
}
/**
 * 导出学生名单
 */
function exportStudentList() {
    return fetch({
        url:'/api/scoremanagementservice/scoreFailCreditManageController/exportFailedStudentZip?language=cn',
        method:'post',
    })
}
function downStatus(key){//导出
    return fetch ({
        url:`/api/scoremanagementservice/scoreFailCreditManageController/exportFailedStudentZipByKey?key=${key}`,
        method:'get',
    })
}

export default{
    getFailCredit,
    saveFailCredit,
    queryFailCreditSection,
    queryFailCreditStudentPage,
    queryChangeInfoData,
    queryConditionData,
    queryStudentListData,
    exportStuInfo,
    exportStudentList,
    downStatus
}